﻿using System;
using System.Net;
using System.Net.Sockets;

namespace Anchor.Sockets
{
    class SocketAccept
    {
        private int SocketID;
        public void CallAccept(IAsyncResult iAr)
        {
            Socket Server = (Socket)iAr.AsyncState;
            Socket Client = Server.EndAccept(iAr);
            SocketID++;

            //Console.WriteLine();
            new SocketRequest().Invoke(SocketID, Client);

            Server.BeginAccept(new AsyncCallback(CallAccept), Server);
        }
    }
}
